package com.twentytwok.hospitalsystem22K.controller;

import com.github.pagehelper.PageInfo;
import com.twentytwok.hospitalsystem22K.common.Code;
import com.twentytwok.hospitalsystem22K.common.PageVo;
import com.twentytwok.hospitalsystem22K.common.R;
import com.twentytwok.hospitalsystem22K.common.R2;
import com.twentytwok.hospitalsystem22K.pojo.Comment;
import com.twentytwok.hospitalsystem22K.pojo.DoctorUser;
import com.twentytwok.hospitalsystem22K.pojo.Drug;
import com.twentytwok.hospitalsystem22K.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@CrossOrigin("*")
@RequestMapping("/comment")
@RestController
public class CommentController {

    @Autowired
    private CommentService commentService;

    @RequestMapping("/pageData")
    public PageVo<Comment> getPageData(@RequestParam Map<String, Object> params) {

        return commentService.getPageData(params);
    }

    @RequestMapping("/update")
    public R2 update(Comment comment) {
        return commentService.update(comment);
    }

    @RequestMapping("/delete")
    public R2 delete(Integer id){
        return commentService.delete(id);
    }

    @RequestMapping("/add")
    public R2 add(Comment comment) {
        return commentService.add(comment);
    }
}
